<%/*
 * Copyright (c) 2007
 *	Alberto Magni, Maggioni Marcello
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 */%>
 
 <%-- 
    Document   : recipients
    Created on : 23-nov-2007, 11.07.01
    Author     : alberto
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="beans.UserDataBean,java.util.*"%>
<%@page import="Database.*;"%>
<%@ taglib uri="/WEB-INF/tlds/login" prefix="access" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Recipients</title>
    </head>
    <body>
        <access:LoginTag/>
        <jsp:include page="username.jsp"/>
        <jsp:useBean id="maildatabase" class="beans.MailBean" scope="session"/>
        <jsp:useBean id="loggedin" type="beans.LoginBean" scope="session"/>
        <h2>You are going to send your mail to the following addresses:<br>Are you sure?<br></h2>
        <%
        ConfigurationDB cdb = (ConfigurationDB) this.getServletContext().getAttribute("configurationdb");
        for(int index=0;index<maildatabase.getRecipients().length;index++)
        {
            out.println("<ul>");
            out.println("<li>"+maildatabase.getRecipients()[index]+"</li>");
            out.println("</ul>");
        }
        if(cdb.getSpamCheck(null))
        {
            out.println("<br>Spam Rating<br>");
            out.println("<br>Your email has scored: "+maildatabase.getRate()+" when the limit is: "+maildatabase.getLimit()+".<br>");
            if(maildatabase.getRate().floatValue()<maildatabase.getLimit().floatValue())
            {
                out.println("Hmm... I am very disappointed, you are not spamming anyone!<br>");
            }
            else
            {
                out.println("Yeah, you are a spammer!<br>");
            }
            if(maildatabase.getTable()!=null)
            {
                out.println("<br> Your mail has the following warnings");
                out.println(maildatabase.getTable());
            }
        }
        %>
        <td><form action="SenderSrv"><button type="submit">Send</button></form></td>
        <td><form action="datainput.jsp"><button type="submit">Back</button></form></td>
    </body>
</html>
